(rmail-redecode-body): If the old encoding is `undecided', call
authorEli Zaretskii <eliz@gnu.org>
Sat, 7 Oct 2006 13:12:42 +0000 (13:12 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 7 Oct 2006 13:12:42 +0000 (13:12 +0000)
find-coding-systems-region to find a proper non-trivial encoding.

lisp/mail/rmail.el

index 473175e142b03db88b2ecbcfd8313178a540c5b5..b196d906f81da9aef9ef4d77210f50c9fb68e536 100644 (file)
@@ -2875,6 +2875,12 @@ iso-8859, koi8-r, etc."
                          (coding-system-change-eol-conversion
                           coding
                           (coding-system-eol-type old-coding)))
+                   ;; If old-coding is `undecided', encode-coding-region
+                   ;; will not encode the text at all.  Find a proper
+                   ;; non-trivial encoding to use.
+                   (if (memq (coding-system-base old-coding) '(nil undecided))
+                       (setq old-coding
+                             (car (find-coding-systems-region msgbeg msgend))))
                    (setq x-coding-header (point-marker))
                    (narrow-to-region msgbeg msgend)
                    (encode-coding-region (point) msgend old-coding)